<template>
  <section class="inner systemMaintenance">
    <section class="inner-top">
      <span>系统配置</span>
    </section>
    <section class="inner-bottom">
      <div>
        <h3 style="margin-bottom:15px;font-size:14px;">火车站点维护</h3>
        <el-upload class="upload-demo" accept=".xls, .xlsx" :on-change="handleChange" :file-list="fileList" action="https://jsonplaceholder.typicode.com/posts/" :before-upload="beforeAvatarUpload">
          <el-button size="small" type="primary">导入站点数据</el-button>
          <div slot="tip" class="el-upload__tip">仅限导入Excel文件,导入后重新导入即可覆盖原有导入内容</div>
        </el-upload>
      </div>
    </section>
  </section>
</template>
<script>
export default {
  name: 'systemMaintenance',
  data () {
    return {
      fileList: []
    }
  },
  methods: {
    beforeAvatarUpload (file) {
      const isExcel = file.type === 'application/vnd.ms-excel' || file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
      if (!isExcel) {
        this.$message.error('只能上传Excel文件!')
      }
      return isExcel
    },
    handleChange (file, fileList) {
      this.fileList = fileList.slice(-3)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
